package com.cli.unified_data_format.controller;

/**
 * @Author xiongmin
 * @Description //TODO
 * @Date 2020/9/20 1:05
 * @Version 1.0
 **/

import com.cli.unified_data_format.exception.ResourceNotFoundException;
import com.cli.unified_data_format.model.Person;
import com.google.common.collect.ImmutableMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class ExceptionController {

    @GetMapping("/resourceNotFound")
    public void throwException() {
        Person p = new Person(1L, "SnailClimb");
        throw new ResourceNotFoundException("can`t find the name of SnailClimb", ImmutableMap.of("person id:", p.getId()));
    }

}
